<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>


<input type="text" width="200px" id = "input1">
<input type="button" value="添加美女图" onclick="fun(1)">
<input type="button" value="添加帅哥图" onclick="fun(2)">

<div></div>

<script>
    let input1 = document.querySelector("#input1");
    let div = document.querySelector("div");
    let img=document.createElement("img");
    function fun(x){
        let imgName = x==1?"../2图片.webp":"../day3_Img/2.png";//固定的图片名
        for(let i=0;i<input1.value;i++){
            let img = document.createElement("img");
            img.src=imgName;
            document.body.appendChild(img);
        }




    }


</script>
</body>
</html>